﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DongFangGuoKai.WMSPlatform.Commn.ExtendModule
{
    public static partial  class Extend
    {
        /// <summary>
        /// 字符串转换为数组
        /// </summary>
        /// <param name="str"></param>
        /// <returns></returns>
        public static List<string> StringToList(this string str)
        {
            if (string.IsNullOrWhiteSpace(str))
            {
                return null;
            }
            List<string> list = str.Split(new char[] { ';', '；', '、', ',', '，', '|' }, StringSplitOptions.RemoveEmptyEntries).ToList();
            return list;
        }

        public static int StringToInt32(this string str)
        {
            int num = -1;
            if (int.TryParse(str, out num))
            {
                return num;
            }
            else
            {
                return -1;
            }
        }
        public static bool IsNullOrEmpty(this string str)
        {
            return string.IsNullOrWhiteSpace(str);
        }

    }
}
